import { delToken, getToken, setToken, getUserInfo, setUserInfo, delUserInfo } from '@/utils/storage'
import tool from '@/utils/tool';

export default {
  namespaced: true,
  state () {
    return {
      token: getToken('T_TOKEN') || '',
      userInfo:  tool.data.get('T_USER_INFO'),
      menuState: false,//
      isFull:false,//是否开启全屏
      fullState:0,//控制进入全屏按钮
      ischange:false,//是否进入了上课的页面
    }
  },
  mutations: {
    setUserToken (state, payload) {
      state.token = payload
      setToken('T_TOKEN', payload)
    },
    logout (state) {
      state.token = ''
      state.userInfo = null
      delToken('T_TOKEN')
      delUserInfo('T_USER_INFO')
    },
    setUserInfo (state, payload) {
      state.userInfo = payload
      setUserInfo('T_USER_INFO', payload)
    },
    setmenu(state,bool){
      state.menuState=bool
    },
    setFull(state,bool){
      state.isFull=bool
    },
    setfullState(state,num){
      state.fullState=num
    },
    setChange(state,bool){
      state.ischange=bool
    }
  },
  actions: {},
  getters: {}
}
